<?php
namespace app\cron\controller;

use think\Controller;

class IndexController extends Controller
{
    public function index()
    {
        /**
         * @todo 显示最后运行时间
         * @todo 显示调用记录
         * @todo 显示可用的操作
         */
        $time=session("last_run_time");
        $this->assign("last_run_time",date("Y-m-d H:i:s",$time));

        $actions=[
            ["name"=>"定时清理","set"=>"setCleanRuntimeFile","run"=>""],
        ];
        $this->assign("actions",$actions);
        return $this->fetch();
    }
    /**
     * 定时运行的入口
     */
    public function run()
    {
        session("last_run_time",time());
        $this->cleanRuntimeFile();
    }
}
